package com.noahplat.gateway.filter;

/**
 * 作者：李景星
 * 描述：配置需要放行的URL
 * 时间：2020-11-03
 */
public class URLFilter {
    // 后期需要方向的请求url
    private static String uri = "/api/oauth/login,/api/oauth/regist,/api/user/resetPassword,/api/sys/getSysInfo,/api/oufu/recv/handler,/api/oufu/recv/poFence,/api/user/register,/api/person/initPerson,/api/sms/sendRegCode,/api/sms/sendAPassCode,/api/user/getUserByPhone,/api/fourg/getDeviceData,/api/version/getVersionByStid";

    // 判断用户的请求是否包含上面允许放行的uri
    public static boolean hasAuthorization(String url) {
        String[] uris = uri.split(",");
        for (String uri : uris) {
            if (url.startsWith(uri)) {
                return true;            // 放行
            }
        }
        return false;                   // 拦截
    }
}
